<?php
// Removes the notice which occurs at the first page of the instructions
error_reporting (E_ALL ^ E_NOTICE); /* 1st line (recommended) */ 
try{
 
session_start();
//require('dbconnection.php');

$NUM_INSTRUCTION_PAGES = 4;

// Keeps track of the number of pages
if(!isset($_SESSION['views'])){
  session_register('views');
  $_SESSION['views'] = 1;
 }else{
  $_SESSION['views']++;
 }



$counter =$_SESSION['views'];


if($counter < $NUM_INSTRUCTION_PAGES){
  
  
  displayInstructionPage($counter);
 }else{
  
  // Need to do error checking that the session variable is set
  // This means that the person has logged on correctly.
  if(isset($_SESSION['uname'])){

    include_once('prototype.php');
  }else{
    // Login error
    include_once('errorlogin.php');
  }
  // Finished the learning process
 }




}catch(Exception $e){
	//echo $e;
}

// Pardon the uglyness of the code
// This displays the instruction page
function displayInstructionPage($pageNum){
  $filename = "instruct".$pageNum.".html";
  require("pageinstruct.php");
  $header = "";
  $header = addHeader("Captcha Collection");
  echo($header);
  // The code is really ugly
  echo "<div id='menucontainer'>";
  echo "<div id='menu'>";
  echo "<div id='navcontainer'>";
  echo "<ul id='navlist'>";
  echo "</ul>";
  echo "</div>";
  echo"</div>";
  echo"</div>";
  echo " <div id='content'>";
  include($filename);
  
 
  echo "<a href='instructions.php' class='direct'>Next</a>";
  echo "</div>";
  echo(addFooter());

}
?>
